package com.faradel.pharmapp.service;

import java.util.List;

import javax.annotation.Resource;

import org.faradel.pharmapp.entities.PrescriptionOrder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.faradel.pharmapp.dao.PrescriptionOrderDAO;

@Service("prescriptionOrderServiceImpl")
public class PrescriptionOrderServiceImpl implements PrescriptionOrderServiceInterface
{
    @Resource
    PrescriptionOrderDAO prescriptionOrderDaoImpl;

    @Override
    @Transactional(readOnly = false)
    public void addPrescriptionOrder(PrescriptionOrder order)
    {
        prescriptionOrderDaoImpl.save(order);
    }

    @Override
    @Transactional(readOnly = true)
    public void updatePrescriptionOrder(PrescriptionOrder order)
    {
        prescriptionOrderDaoImpl.update(order);
    }

    @Override
    @Transactional(readOnly = true)
    public void deletePrescriptionOrder(PrescriptionOrder order)
    {
        prescriptionOrderDaoImpl.delete(order);
    }

    @Override
    @Transactional(readOnly = false)
    public PrescriptionOrder getPrescriptionOrderById(int id)
    {
        return prescriptionOrderDaoImpl.get(id);
    }

    @Override
    @Transactional(readOnly = false)
    public List<PrescriptionOrder> getAllPrescriptionOrder()
    {
        // TODO Auto-generated method stub
        return prescriptionOrderDaoImpl.selectAll();
    }

}
